#!/usr/bin/Python
# encoding: UTF-8
# Created by zhao at 2017/11/21

import time
import json
import codecs

class TutorialPipeline2json(object):
    def process_item(self,item,spider):
        today=time.strftime('%Y%m%d',time.localtime())
        fileName=today+'.json'
        with codecs.open(fileName,'a',encoding='utf8') as fp:
            line=json.dumps(dict(item),ensure_ascii=False)+'\n'
            fp.write(line)
        return item